-- ZdSt - zmena nasobnosti DT 148,0 (spustit)
<g>
  UPDATE a101u0 SET a211u0 = 3 WHERE (ic = 148) AND (u = 0)
</g>

--LuP: naplneni tridy 144,9 "Vyskyty statku" (SPUSTIT)
  --Casti energeticke soustavy
<g>
<a>
insert into a144u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a226429u10103 as A
left outer join a144u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
  insert into a144u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a226429u10103 as A
left outer join a144u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

--LuP: naplneni tridy 145,9 "Konkretni vyskyty statku" a "Vyskyty statku"(SPUSTIT)
  --Casti energeticke soustavy
<g>
<a>
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a226429u10103 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a226429u10103 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

--MaSu: naplneni tridy "Protokoly" (3356513,10) z tridy "Protokoly akc " (2396269,10) (SPUSTIT)
<g>
<a>
insert into a3356513u10 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a2396269u10 as A
left outer join a3356513u10 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
insert into a3356513u10 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a2396269u10 as A
left outer join a3356513u10 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

-- Doprava: Druh balení přepravní zásilky -> Druh statku (Nespustit)
<g>
<p>
insert into a6867954u10 (u, ic, ts0, useric, useru, remotekey, langstate, u_a, ic_a, u_b, ic_b)
select src.u, src.ic, getdate(), 1105, 0, src.remotekey, src.langstate, src.u_a, src.ic_a, src.u_b, src.ic_b
</p>
<a>
insert into a6867954u10 (u, ic, ts0, useric, useru, remotekey, langstate, u_a, ic_a, u_b, ic_b, sstate, sstate_a, sstate_b)
select src.u, src.ic, getdate(), 1105, 0, src.remotekey, src.langstate, src.u_a, src.ic_a, src.u_b, src.ic_b, 0, 0, 0
</a>
from a260093u10212 src
left outer join a6867954u10 dst on src.ic = dst.ic and src.u = dst.u
where dst.ic is null
delete src
from a260093u10212 src
inner join a6867954u10 dst on src.ic = dst.ic and src.u = dst.u
</g>

-- Doprava: Výchozí část přepravní zásilky -> Povolená struktura manipulačních jednotek
<g>
<p>
insert into a38184164u10 (u, ic, ts0, useric, useru, remotekey, langstate, u_a, ic_a, u_b, ic_b)
select src.u, src.ic, getdate(), 1105, 0, src.remotekey, src.langstate, src.u_a, src.ic_a, src.u_b, src.ic_b
</p>
<a>
insert into a38184164u10 (u, ic, ts0, useric, useru, remotekey, langstate, u_a, ic_a, u_b, ic_b, sstate, sstate_a, sstate_b)
select src.u, src.ic, getdate(), 1105, 0, src.remotekey, src.langstate, src.u_a, src.ic_a, src.u_b, src.ic_b, 0, 0, 0
</a>
from a833919u10212 src
left outer join a38184164u10 dst on src.ic = dst.ic and src.u = dst.u
where dst.ic is null
</g>
